<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" href="../../css/lib/mui/mui.css">
		<link rel="stylesheet" href="../../css/common/animate.css">
		<link rel="stylesheet" href="../../css/common/common.css"/>
	</head>

	<body>
		<header class="header-backcolor mui-bar mui-bar-nav">
			<a id="title_icon" class="mui-action-back  pan_header_a_left">
					<div id="backBtn">
						<img id="back_img" src="../../img/menu/ico_return.png" class="pan_header_left_img_block" >
						<button class="mui-action-back mui-btn mui-btn-blue mui-btn-link mui-btn-nav mui-pull-left">
							<span class="pan_header_left_span_block" id="back">返回</span>
						</button>	
					</div>
			</a>
			<h1 class="mui-title" id="title"></h1>
		</header>
		<div class="mui-content">
			<ul class="mui-table-view" id="content">
				
			</ul>
		</div>
		<script type="text/javascript" src="../../js/common/config.js" ></script>
		<script type="text/javascript" src="../../js/lib/mui/mui.js"></script>
		<script type="text/javascript" src="../../js/lib/jquery/jquery.js"></script>
		<script type="text/javascript" src="../../js/common/common.js" ></script>
		<script type="text/javascript" src="../../js/lib/jquery/jquery.json.js" ></script> 
		<script>
			mui.init({
				swipeBack:false, //启用右滑关闭功能
				keyEventBind: {
					backbutton: false  //关闭back按键监听
				}
			}); 
			mui.plusReady(initSomething);
			
			var userid;
			function initSomething(){
				var self = plus.webview.currentWebview();
				var pid = self.pid;//上个页面传来的pid
				var name = self.name;
				$("#title").html(name);
				userid = common.utils.getUserId();
				initData(pid);
			}

			//获取数据
			function initData(pid){
				mui.ajax(ctx+"mobile/nowSee/getList?pid="+pid,{
					dataType:'json',//服务器返回json格式数据
					type:'post',//HTTP请求类型
					timeout:10000,//超时时间设置为10秒；	              
					success:function(data){
						var html = '';
				       	if(data&&data.success){
				       		$.each(data.data,function(m,n){
								html = html + '<li class="mui-table-view-cell nowSeeLi" data-id="'+n.id+'" data-url="'+n.url+'" data-name="'+n.name+'">';
								html = html + '	<a class="mui-navigate-right">';
								html = html + 		n.name;
								html = html + '	</a>';
								html = html + '</li>';
							});
				      	}else{
				      		alert('服务器异常链接失败!');
				      	}
				      	$("#content").html(html);
				      	$(".nowSeeLi").off("tap");
						$(".nowSeeLi").on("tap",function(){
							var url = $(this).attr("data-url");
							var name = $(this).attr("data-name");
							if(url&&url.length>0&&url!='null'&&url!='undefined'){//如果url存在，打开视频
								
							}else{//不存在打开下一级
								var id = $(this).attr("data-id");
								var view = plus.webview.create("../nowSee/nowSee.html", "../nowSee/nowSee.html", {},{"pid":id,"name":name});
								plus.webview.show(view, "slide-in-right", "350ms", function() {}, false);	
							}
						});
					},
					error:function(xhr,type,errorThrown){
						alert('服务器异常链接失败!');
					}
				});
			}
			
			function initHtml(data){
				var html = '';
				$.each(data,function(m,n){
					html = html + '<li class="mui-table-view-cell animated fadeInRight " data-id="'+data[m].id+'" style="animation-delay: 0.'+m+'s;">';
					html = html + '<div class="mui-table">';
					html = html + 		'<div class="mui-table-cell mui-col-xs-9">';
					html = html + 			'<h4 class="mui-ellipsis">'+data[m].title+'</h4>';
					html = html + 			'<p class="mui-h6 mui-ellipsis">'+data[m].sub_title+'</p>';
					html = html + 		'</div>';
					html = html + 		'<div class="mui-table-cell mui-col-xs-3 mui-text-right">';
					html = html + 			'<span class="mui-h5" style="font-size:10px">'+data[m].publish_time+'<br/>'+'</span>';
					html = html + 		'</div>';
					html = html + '</div>';
					html = html + '</li>';
				});
				$("#container").append(html);
				$("#container").show();
				$(".mui-table-view-cell").off("tap");
				$(".mui-table-view-cell").on("tap",function(){
					var id = $(this).attr("data-id");
					var view = plus.webview.create("viewNotice.html", "viewNotice.html", {},{"noticeid":id});
					//	显示新页面
					plus.webview.show(view, "slide-in-right", "350ms", function() {}, false);
				});
			}

			
		</script>
	</body>
</html>
